﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SPPD.model;
namespace SPPD.controller
{
    class controller_login
    {
        public int login(string text)
        {
            controller_pegawai peg = new controller_pegawai();
            int find = 0;
            var categories = peg.load();
            for (int i = 0; i < categories.Count; i++)
            {
                if (categories[i].nama == text)
                {
                    find = 1;
                    break;
                }
            }
            if (find == 0) {  return 0; }
            if (text[0] == 'm')
            {
                return 1;
            }
            else
                if (text[0] == 'b')
                {
                    return 2;
                }
                else
                    if (text[0] == 'p')
                    {
                        return 3;
                    }
                    else
                        return 0;
        }
    }
}
